$(function(){

});



// 异步加载分页数据
function loadEachPageItemInfo(pageNum) {
	$.post("userIndex_page.action?t=" + Math.random(), {
				page : pageNum
			}, function(data) {
				$("#div_mall_index_product_page").empty().html(data);
			});
}

function addOrderItem(id){
	if($("#hid_userId").val()){
		$.post("cartUser_add.action?t=" + Math.random(), {
					"productId" : id
				}, function(data) {
					 var d = eval("("+data+")");
					if(d.status == true){
						alert("添加成功");
					}else{
						alert(d.message);
					}
				});
	}else{
		window.location.href="toUserLogin.action";
	}

}

function buy(id){
	if($("#hid_userId").val()){
		$.post("cartUser_add.action?t=" + Math.random(), {
					"productId" : id
				}, function(data) {
					var d = eval("("+data+")");
					if(d.status == true){
						window.location.href="cartUser_index.action";
					}else{
						alert(d.message);
					}
				});
	}else{
		window.location.href="toUserLogin.action";
	}

}
//修改套餐
function modify(id){
	if($("#hid_userId").val()){
		$.post("productManager_toModify.action?t=" + Math.random(), {
					"productId" : id
				}, function(data) {
					var d = eval("("+data+")");
					if(d.status == true){
						alert("修改成功");
						window.location.href="userIndex_list.action";
					}else{
						alert(d.message);
					}
				});
	}else{
		window.location.href="toAdminLogin.action";
	}

}
//下架套餐
function toDown(id,name){
	if($("#hid_userId").val()){
		$.post("productManager_toDown.action?t=" + Math.random(), {
					"productId" : id
				}, function(data) {
					var d = eval("("+data+")");
					if(d.status == true){
						alert(name+"下架成功");
						window.location.href="userIndex_list.action";
					}else{
						alert(d.message);
					}
				});
	}else{
		window.location.href="toAdminLogin.action";
	}

}




